﻿using System;
using System.Data;
using System.Data.OleDb;

namespace DataBase
{
    public class Edit
    {
        public static void CreateTable(string DBcommand)
        {
            String connect = "Provider=Microsoft.JET.OLEDB.4.0;data source=" + teacherplanner.Properties.Settings.Default.CurrentPlanner;
            OleDbConnection con = new OleDbConnection(connect);
            con.Open();
            OleDbCommand cmd = con.CreateCommand();

            cmd.CommandText = DBcommand;
            cmd.ExecuteNonQuery();

            con.Close();
        }

        public static void ApplySQLArray(string[] insertArray)
        
        {
            String connect = "Provider=Microsoft.JET.OLEDB.4.0;data source=" + teacherplanner.Properties.Settings.Default.CurrentPlanner;
            int myCount = insertArray.GetLength(0);
            OleDbConnection con = new OleDbConnection(connect);
            con.Open();
            OleDbCommand cmd = con.CreateCommand();
            for (int i = 0; i < myCount; i++)
            {
                cmd.CommandText = insertArray[i];
                cmd.ExecuteNonQuery();
            }          
            con.Close();
        }



    }

}